<?php
	require_once( 'core_DataBaseConnect.php' );
	require_once( 'core_ErrorCode.php' );
	require_once( 'core_Response.php' );
	require_once( 'dao_FreeBoardDAO.php' );
	require_once( '_configs.php' );
	
	function func( $con, $post, $returnType )
	{
		// 1. 전체 사업 수
		$response = array();
		$response[ 'count' ] = FreeBoardDAO::countListItems( $con );
		
		// 2. 조회
		$result = FreeBoardDAO::selectFreeBoardList( $con, $post[ 'page' ], $post[ 'numPerPage' ], true );
		$response[ 'item' ] = array();
		while( $fetch = DataBaseConnect::fetch_assoc( $result ) )
		{
			$item = DataBaseConnect::fetchSerialize( $fetch, array( 'SEQ', 'TITLE', 'DESC', 'REGIST_DATE', 'OWNER_ID', 'OWNER_NICKNAME', 'STATUS' ) );
			array_push( $response[ 'item' ], $item );
		}
		
		return Response::SUCCESS( $response, $returnType );
	}
?>